/**
 * @(#) CongMoneyMediator.as
 *
 * @date		2009. 03. 25.
 * @version		1.0
 * @author		baek, kwang hyoun
 * @description	건강보험증 신청 - Mediator
 * 				건강보험증을 조회하고 신청하는 Presentation Logic을 관리
 */
package com.skt.common_hr.empcontnos.view
{
	import com.skt.common_hr.common.Variables;
	import com.skt.common_hr.common.puremvc.OverViewMediator;
	import com.skt.common_hr.empcontnos.model.EmpcontProxy;
	import com.skt.common_hr.empcontnos.view.components.EmpcontOverViewNos;
	
	import mx.collections.ArrayCollection;
	
	import org.puremvc.as3.multicore.interfaces.INotification;

	public class EmpcontNosMediator extends OverViewMediator
	{
		public static const NAME:String = "EmpcontNosMediator";

		/**
		* 생성자
		*
		* @param
		* @return void
		*/
        public function EmpcontNosMediator( viewComponent:Object )
        {
            super( NAME, viewComponent );
        }

		/**
		* View를 초기화 한다.
		*	- View에 기본사항을 출력하고 data를 load
		* @param
		* @return void
		* 최초 한번만 불림
		*/
 		override protected function initializeView():void
 		{
			//super.initializeView();
			clearView();
//			var passWordMediator:PassWordCheckMediator = facade.retrieveMediator(PassWordCheckMediator.NAME) as PassWordCheckMediator;
//			passWordMediator.execute();			
 		}
 		
 		override protected function clearView():void
 		{ 			
 			//비밀번호풀기nos20140425
 			// 0으로 바꾸고 .. loadList(); 지운다 
 			view.vsCompensation.selectedIndex = 1
 			loadList(); 			
 		}
 		
		/***
		 * 활성화가 될때마다 불림.
		 */
		override protected function activatedView():void
		{
			//super.activatedView();
			clearView();
//			var passWordMediator:PassWordCheckMediator = facade.retrieveMediator(PassWordCheckMediator.NAME) as PassWordCheckMediator;
//			passWordMediator.execute();
			//loadList();
		}
		
		private function loadList():void
 		{
 			view.initView();
 		}

		override protected function closedView():void
		{
			removeEventListener();
		} 
		
		private function removeEventListener():void
 		{
			//view.removeEventListener(HthIcFacade.HthIcWrite, onClickNew);
 		}

		/**
		* 본 Class에서 처리해야할 Noti들을 등록한다.
		*
		* @param
		* @return void
		*/
		override public function listNotificationInterests():Array 
		{
			return basicInterestMessages.concat([
					PassWordCheckMediator.VALID_PASSWORD
					// reload
					]);
		}


		/**
		* Noti별로 처리한다.
		*
		* @param
		* @return void
		*/
		override public function handleNotification(note:INotification):void
		{
			super.handleNotification(note);
			switch(note.getName())
			{
				case PassWordCheckMediator.VALID_PASSWORD:
					view.vsCompensation.selectedIndex = 1;
 					loadList();
					break;
				default:
					//trace(this.instanceID+"에서 처리 안된 Noti가 검출됨 : " + note.getBody());
					break;
			}
		}


 		/**
		 * Proxy에서 DataLoad를 완료한 후 호출됨
		 *     - load된 데이터를 화면에 출력
		 * @param
		 * @return void
		 */
 		private function setListView(list:ArrayCollection):void
 		{
// 			view.medicalMoneyDataList = list;
// 			commonFacade.setStatusMessage("STATUS_LOADED_LIST", [list.length.toString()]);
// 			if(list.length == 0) {
// 				view.showInitialTip();
// 			}
 		}


		///////////////////////////////////////////////////////////////////////////////////////////////////
		//
		//	Event handler (from View, Internal or....)
		//
		///////////////////////////////////////////////////////////////////////////////////////////////////
       private function get view():EmpcontOverViewNos
        {
            return viewComponent as EmpcontOverViewNos;
        }


	}
}